﻿using System;
using System.Collections;
using System.Collections.Generic;
using LL.Common;

namespace LL.Data
{
    /// <summary>
    /// 通用实体查询
    /// </summary>
    public interface IRepository
    {

        //取
        TEntity Get<TEntity>(params object[] key);
        IList<TEntity> GetAll<TEntity>();

        //增
        int Insert(object entity);

        //删
        int Delete(object entity);
        int Delete<TEntity>(params object[] key);
        int Delete<TEntity>(string where, params object[] key);

        //改
        int Update(object entity);

        //存在
        bool Exist<TEntity>(params object[] key);
        bool Exist(object entity);

        //查
        IList<TEntity> Query<TEntity>(string where, params object[] parameters);

        //IList<TEntity> QueryWithPaging<TEntity>(int pageIndex, int pageSize, out int totalRows,
        //        string orderBy = null, string where = null, params object[] parameters);

        /// <summary>
        ///  when  insert an entity if you want to ignore the key, please use the method (dr:ruiky)
        /// </summary>
        /// <param name="entity">entity</param>
        /// <param name="ignoreKey">ignorekey</param>
        /// <returns></returns>
        int Insert(object entity, params string[] ignoreKey);

   }
}
